package oo.shootgame;
import java.awt.image.BufferedImage;
public class FirstBoss extends Plane{
	 private int xspeed;
	 private int yspeed;
	 protected BufferedImage[] images;
	 private int index;
	 FirstBoss(){
		 image=ShootGame.firstboss0;		 
		 life=400;
		 width=image.getWidth();
		 height=image.getHeight();
		 x=(ShootGame.WIDTH-width)/2;
		 y=-height;
		 images=new BufferedImage[]{ShootGame.firstboss0,ShootGame.firstboss1,ShootGame.firstboss2,ShootGame.firstboss3,ShootGame.firstboss4};
		 index=0;
		 xspeed=1;
		 yspeed=3;
	 }
	 public void step(){
		 index++;
		 if(life>=300){
			 if(index%50==0){
				 image=images[0];
			 }
		 }else if(life>=200){
			 if(index%50==0){
				 image=images[1];
			 }
		 }else if(life>=100){
			 if(index%50==0){
				 image=images[2];
			 }
		 }else {
			 if(index%50==0){
				 image=images[3];
			 }
		 }		 
		 x+=xspeed;
		 y+=yspeed;
		 if(x>=ShootGame.WIDTH-width){
			 xspeed=-1;
		 }
		 if(x<=0){
			 xspeed=1;
		 }
		 if(y<=0){
			 yspeed=3;
		 }
		 if(y>=ShootGame.HEIGHT/2-height){
			 yspeed=-3;
		 }
	 }
	 public Bullet[] shoot1(){
		 Bullet[] b1={new Bullet(x,y+height/2)};
		 return b1;
	 }
	 public Bullet[] shoot2(){
		 Bullet[] b2={new Bullet(x,y+height)};
		 return b2;
	 }	
	 public Bullet[] shoot3(){		 
		 Bullet[] b3={new Bullet(x+width/2,y+height+10)};
		 return b3;
	 }
	 public Bullet[] shoot4(){		 
		 Bullet[] b4={new Bullet(x+width,y+height)};
		 return b4;
	 }
	 public Bullet[] shoot5(){		 
		 Bullet[] b5={new Bullet(x+width,y+height/2)};
		 return b5;
	 }
	 public Bullet[] shoot6(){
		 Bullet[] bs=new Bullet[5];
		 bs[0]=new Bullet(x,y+height/2);
		 bs[1]=new Bullet(x,y+height);
		 bs[2]=new Bullet(x+width/2,y+height+10);
		 bs[3]=new Bullet(x+width,y+height);
		 bs[4]=new Bullet(x+width,y+height/2);
		 return bs;
	 }
}
